<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>事件处理</title>
    <script src="../js/vue.js"></script>
    <style>

    </style>
</head>

<body>
    <div id="root">
        <h2>今天天气{{info}}</h2>
        <button @click="changeWeather">切换天气</button>
    </div>
    <script>
        Vue.config.productionTip = false

        const vm = new Vue({
            el: '#root',
            data: {
                isHost: true
            },
            computed: {
                info() {
                    return this.isHost === true ? '炎热' : '凉爽'
                }
            },
            methods: {
                changeWeather() {
                    this.isHost = !this.isHost
                }
            },
        })
    </script>
</body>

</html>